class Question < ActiveRecord::Base
	belongs_to :exam
	has_many :answers
  
  ##
  # creates a deep copy of the question-object
  # @return a deep copy of the question-object is returned
  def deep_copy
		q = Question.new
		q.text = self.text
		q.score = self.score
		q.checkbox = self.checkbox
    for answer in self.answers
      a = answer.deep_copy
      a.question = q
      q.answers << a
    end
    return q
  end
end
